#
# speed 8M
#
MCP_8MHz_1000kBPS_CFG1 = 0x00
MCP_8MHz_1000kBPS_CFG2 = 0x80
MCP_8MHz_1000kBPS_CFG3 = 0x80

MCP_8MHz_500kBPS_CFG1 = 0x00
MCP_8MHz_500kBPS_CFG2 = 0x90
MCP_8MHz_500kBPS_CFG3 = 0x82

MCP_8MHz_250kBPS_CFG1 = 0x00
MCP_8MHz_250kBPS_CFG2 = 0xB1
MCP_8MHz_250kBPS_CFG3 = 0x85

MCP_8MHz_200kBPS_CFG1 = 0x00
MCP_8MHz_200kBPS_CFG2 = 0xB4
MCP_8MHz_200kBPS_CFG3 = 0x86

MCP_8MHz_125kBPS_CFG1 = 0x01
MCP_8MHz_125kBPS_CFG2 = 0xB1
MCP_8MHz_125kBPS_CFG3 = 0x85

MCP_8MHz_100kBPS_CFG1 = 0x01
MCP_8MHz_100kBPS_CFG2 = 0xB4
MCP_8MHz_100kBPS_CFG3 = 0x86

MCP_8MHz_80kBPS_CFG1 = 0x01
MCP_8MHz_80kBPS_CFG2 = 0xBF
MCP_8MHz_80kBPS_CFG3 = 0x87

MCP_8MHz_50kBPS_CFG1 = 0x03
MCP_8MHz_50kBPS_CFG2 = 0xB4
MCP_8MHz_50kBPS_CFG3 = 0x86

MCP_8MHz_40kBPS_CFG1 = 0x03
MCP_8MHz_40kBPS_CFG2 = 0xBF
MCP_8MHz_40kBPS_CFG3 = 0x87

MCP_8MHz_33k3BPS_CFG1 = 0x47
MCP_8MHz_33k3BPS_CFG2 = 0xE2
MCP_8MHz_33k3BPS_CFG3 = 0x85

MCP_8MHz_31k25BPS_CFG1 = 0x07
MCP_8MHz_31k25BPS_CFG2 = 0xA4
MCP_8MHz_31k25BPS_CFG3 = 0x84

MCP_8MHz_20kBPS_CFG1 = 0x07
MCP_8MHz_20kBPS_CFG2 = 0xBF
MCP_8MHz_20kBPS_CFG3 = 0x87

MCP_8MHz_10kBPS_CFG1 = 0x0F
MCP_8MHz_10kBPS_CFG2 = 0xBF
MCP_8MHz_10kBPS_CFG3 = 0x87

MCP_8MHz_5kBPS_CFG1 = 0x1F
MCP_8MHz_5kBPS_CFG2 = 0xBF
MCP_8MHz_5kBPS_CFG3 = 0x87

#
# speed 16M
#
MCP_16MHz_1000kBPS_CFG1 = 0x00
MCP_16MHz_1000kBPS_CFG2 = 0xD0
MCP_16MHz_1000kBPS_CFG3 = 0x82

MCP_16MHz_500kBPS_CFG1 = 0x00
MCP_16MHz_500kBPS_CFG2 = 0xF0
MCP_16MHz_500kBPS_CFG3 = 0x86

MCP_16MHz_250kBPS_CFG1 = 0x41
MCP_16MHz_250kBPS_CFG2 = 0xF1
MCP_16MHz_250kBPS_CFG3 = 0x85

MCP_16MHz_200kBPS_CFG1 = 0x01
MCP_16MHz_200kBPS_CFG2 = 0xFA
MCP_16MHz_200kBPS_CFG3 = 0x87

MCP_16MHz_125kBPS_CFG1 = 0x03
MCP_16MHz_125kBPS_CFG2 = 0xF0
MCP_16MHz_125kBPS_CFG3 = 0x86

MCP_16MHz_100kBPS_CFG1 = 0x03
MCP_16MHz_100kBPS_CFG2 = 0xFA
MCP_16MHz_100kBPS_CFG3 = 0x87

MCP_16MHz_80kBPS_CFG1 = 0x03
MCP_16MHz_80kBPS_CFG2 = 0xFF
MCP_16MHz_80kBPS_CFG3 = 0x87

MCP_16MHz_83k3BPS_CFG1 = 0x03
MCP_16MHz_83k3BPS_CFG2 = 0xBE
MCP_16MHz_83k3BPS_CFG3 = 0x07

MCP_16MHz_50kBPS_CFG1 = 0x07
MCP_16MHz_50kBPS_CFG2 = 0xFA
MCP_16MHz_50kBPS_CFG3 = 0x87

MCP_16MHz_40kBPS_CFG1 = 0x07
MCP_16MHz_40kBPS_CFG2 = 0xFF
MCP_16MHz_40kBPS_CFG3 = 0x87

MCP_16MHz_33k3BPS_CFG1 = 0x4E
MCP_16MHz_33k3BPS_CFG2 = 0xF1
MCP_16MHz_33k3BPS_CFG3 = 0x85

MCP_16MHz_20kBPS_CFG1 = 0x0F
MCP_16MHz_20kBPS_CFG2 = 0xFF
MCP_16MHz_20kBPS_CFG3 = 0x87

MCP_16MHz_10kBPS_CFG1 = 0x1F
MCP_16MHz_10kBPS_CFG2 = 0xFF
MCP_16MHz_10kBPS_CFG3 = 0x87

MCP_16MHz_5kBPS_CFG1 = 0x3F
MCP_16MHz_5kBPS_CFG2 = 0xFF
MCP_16MHz_5kBPS_CFG3 = 0x87

#
# speed 20M
#
MCP_20MHz_1000kBPS_CFG1 = 0x00
MCP_20MHz_1000kBPS_CFG2 = 0xD9
MCP_20MHz_1000kBPS_CFG3 = 0x82

MCP_20MHz_500kBPS_CFG1 = 0x00
MCP_20MHz_500kBPS_CFG2 = 0xFA
MCP_20MHz_500kBPS_CFG3 = 0x87

MCP_20MHz_250kBPS_CFG1 = 0x41
MCP_20MHz_250kBPS_CFG2 = 0xFB
MCP_20MHz_250kBPS_CFG3 = 0x86

MCP_20MHz_200kBPS_CFG1 = 0x01
MCP_20MHz_200kBPS_CFG2 = 0xFF
MCP_20MHz_200kBPS_CFG3 = 0x87

MCP_20MHz_125kBPS_CFG1 = 0x03
MCP_20MHz_125kBPS_CFG2 = 0xFA
MCP_20MHz_125kBPS_CFG3 = 0x87

MCP_20MHz_100kBPS_CFG1 = 0x04
MCP_20MHz_100kBPS_CFG2 = 0xFA
MCP_20MHz_100kBPS_CFG3 = 0x87

MCP_20MHz_83k3BPS_CFG1 = 0x04
MCP_20MHz_83k3BPS_CFG2 = 0xFE
MCP_20MHz_83k3BPS_CFG3 = 0x87

MCP_20MHz_80kBPS_CFG1 = 0x04
MCP_20MHz_80kBPS_CFG2 = 0xFF
MCP_20MHz_80kBPS_CFG3 = 0x87

MCP_20MHz_50kBPS_CFG1 = 0x09
MCP_20MHz_50kBPS_CFG2 = 0xFA
MCP_20MHz_50kBPS_CFG3 = 0x87

MCP_20MHz_40kBPS_CFG1 = 0x09
MCP_20MHz_40kBPS_CFG2 = 0xFF
MCP_20MHz_40kBPS_CFG3 = 0x87

MCP_20MHz_33k3BPS_CFG1 = 0x0B
MCP_20MHz_33k3BPS_CFG2 = 0xFF
MCP_20MHz_33k3BPS_CFG3 = 0x87


class CAN_CLOCK:
    MCP_20MHZ = 1
    MCP_16MHZ = 2
    MCP_8MHZ = 3


class CAN_SPEED:
    CAN_5KBPS = 1
    CAN_10KBPS = 2
    CAN_20KBPS = 3
    CAN_31K25BPS = 4
    CAN_33KBPS = 5
    CAN_40KBPS = 6
    CAN_50KBPS = 7
    CAN_80KBPS = 8
    CAN_83K3BPS = 9
    CAN_95KBPS = 10
    CAN_100KBPS = 11
    CAN_125KBPS = 12
    CAN_200KBPS = 13
    CAN_250KBPS = 14
    CAN_500KBPS = 15
    CAN_1000KBPS = 16


class CAN_CLKOUT:
    CLKOUT_DISABLE = -1
    CLKOUT_DIV1 = 0x0
    CLKOUT_DIV2 = 0x1
    CLKOUT_DIV4 = 0x2
    CLKOUT_DIV8 = 0x3


class ERROR:
    ERROR_OK = 0
    ERROR_FAIL = 1
    ERROR_ALLTXBUSY = 2
    ERROR_FAILINIT = 3
    ERROR_FAILTX = 4
    ERROR_NOMSG = 5


class MASK:
    MASK0 = 1
    MASK1 = 2


class RXF:
    RXF0 = 0
    RXF1 = 1
    RXF2 = 2
    RXF3 = 3
    RXF4 = 4
    RXF5 = 5


class RXBn:
    RXB0 = 0
    RXB1 = 1


class TXBn:
    TXB0 = 0
    TXB1 = 1
    TXB2 = 2


class CANINTF:
    CANINTF_RX0IF = 0x01
    CANINTF_RX1IF = 0x02
    CANINTF_TX0IF = 0x04
    CANINTF_TX1IF = 0x08
    CANINTF_TX2IF = 0x10
    CANINTF_ERRIF = 0x20
    CANINTF_WAKIF = 0x40
    CANINTF_MERRF = 0x80


class EFLG:
    EFLG_RX1OVR = 1 << 7
    EFLG_RX0OVR = 1 << 6
    EFLG_TXBO = 1 << 5
    EFLG_TXEP = 1 << 4
    EFLG_RXEP = 1 << 3
    EFLG_TXWAR = 1 << 2
    EFLG_RXWAR = 1 << 1
    EFLG_EWARN = 1 << 0


CANCTRL_REQOP = 0xE0
CANCTRL_ABAT = 0x10
CANCTRL_OSM = 0x08
CANCTRL_CLKEN = 0x04
CANCTRL_CLKPRE = 0x03


class CANCTRL_REQOP_MODE:
    CANCTRL_REQOP_NORMAL = 0x00
    CANCTRL_REQOP_SLEEP = 0x20
    CANCTRL_REQOP_LOOPBACK = 0x40
    CANCTRL_REQOP_LISTENONLY = 0x60
    CANCTRL_REQOP_CONFIG = 0x80
    CANCTRL_REQOP_POWERUP = 0xE0


CANSTAT_OPMOD = 0xE0
CANSTAT_ICOD = 0x0E

CNF3_SOF = 0x80

TXB_EXIDE_MASK = 0x08
DLC_MASK = 0x0F
RTR_MASK = 0x40

RXBnCTRL_RXM_STD = 0x20
RXBnCTRL_RXM_EXT = 0x40
RXBnCTRL_RXM_STDEXT = 0x00
RXBnCTRL_RXM_MASK = 0x60
RXBnCTRL_RTR = 0x08
RXB0CTRL_BUKT = 0x04
RXB0CTRL_FILHIT_MASK = 0x03
RXB1CTRL_FILHIT_MASK = 0x07
RXB0CTRL_FILHIT = 0x00
RXB1CTRL_FILHIT = 0x01

MCP_SIDH = 0
MCP_SIDL = 1
MCP_EID8 = 2
MCP_EID0 = 3
MCP_DLC = 4
MCP_DATA = 5


class STAT:
    STAT_RX0IF = 1 << 0
    STAT_RX1IF = 1 << 1


STAT_RXIF_MASK = STAT.STAT_RX0IF | STAT.STAT_RX1IF


class TXBnCTRL:
    TXB_ABTF = 0x40
    TXB_MLOA = 0x20
    TXB_TXERR = 0x10
    TXB_TXREQ = 0x08
    TXB_TXIE = 0x04
    TXB_TXP = 0x03


EFLG_ERRORMASK = (
    EFLG.EFLG_RX1OVR
    | EFLG.EFLG_RX0OVR
    | EFLG.EFLG_TXBO
    | EFLG.EFLG_TXEP
    | EFLG.EFLG_RXEP
)


class INSTRUCTION:
    INSTRUCTION_WRITE = 0x02
    INSTRUCTION_READ = 0x03
    INSTRUCTION_BITMOD = 0x05
    INSTRUCTION_LOAD_TX0 = 0x40
    INSTRUCTION_LOAD_TX1 = 0x42
    INSTRUCTION_LOAD_TX2 = 0x44
    INSTRUCTION_RTS_TX0 = 0x81
    INSTRUCTION_RTS_TX1 = 0x82
    INSTRUCTION_RTS_TX2 = 0x84
    INSTRUCTION_RTS_ALL = 0x87
    INSTRUCTION_READ_RX0 = 0x90
    INSTRUCTION_READ_RX1 = 0x94
    INSTRUCTION_READ_STATUS = 0xA0
    INSTRUCTION_RX_STATUS = 0xB0
    INSTRUCTION_RESET = 0xC0


class REGISTER:
    MCP_RXF0SIDH = 0x00
    MCP_RXF0SIDL = 0x01
    MCP_RXF0EID8 = 0x02
    MCP_RXF0EID0 = 0x03
    MCP_RXF1SIDH = 0x04
    MCP_RXF1SIDL = 0x05
    MCP_RXF1EID8 = 0x06
    MCP_RXF1EID0 = 0x07
    MCP_RXF2SIDH = 0x08
    MCP_RXF2SIDL = 0x09
    MCP_RXF2EID8 = 0x0A
    MCP_RXF2EID0 = 0x0B
    MCP_CANSTAT = 0x0E
    MCP_CANCTRL = 0x0F
    MCP_RXF3SIDH = 0x10
    MCP_RXF3SIDL = 0x11
    MCP_RXF3EID8 = 0x12
    MCP_RXF3EID0 = 0x13
    MCP_RXF4SIDH = 0x14
    MCP_RXF4SIDL = 0x15
    MCP_RXF4EID8 = 0x16
    MCP_RXF4EID0 = 0x17
    MCP_RXF5SIDH = 0x18
    MCP_RXF5SIDL = 0x19
    MCP_RXF5EID8 = 0x1A
    MCP_RXF5EID0 = 0x1B
    MCP_TEC = 0x1C
    MCP_REC = 0x1D
    MCP_RXM0SIDH = 0x20
    MCP_RXM0SIDL = 0x21
    MCP_RXM0EID8 = 0x22
    MCP_RXM0EID0 = 0x23
    MCP_RXM1SIDH = 0x24
    MCP_RXM1SIDL = 0x25
    MCP_RXM1EID8 = 0x26
    MCP_RXM1EID0 = 0x27
    MCP_CNF3 = 0x28
    MCP_CNF2 = 0x29
    MCP_CNF1 = 0x2A
    MCP_CANINTE = 0x2B
    MCP_CANINTF = 0x2C
    MCP_EFLG = 0x2D
    MCP_TXB0CTRL = 0x30
    MCP_TXB0SIDH = 0x31
    MCP_TXB0SIDL = 0x32
    MCP_TXB0EID8 = 0x33
    MCP_TXB0EID0 = 0x34
    MCP_TXB0DLC = 0x35
    MCP_TXB0DATA = 0x36
    MCP_TXB1CTRL = 0x40
    MCP_TXB1SIDH = 0x41
    MCP_TXB1SIDL = 0x42
    MCP_TXB1EID8 = 0x43
    MCP_TXB1EID0 = 0x44
    MCP_TXB1DLC = 0x45
    MCP_TXB1DATA = 0x46
    MCP_TXB2CTRL = 0x50
    MCP_TXB2SIDH = 0x51
    MCP_TXB2SIDL = 0x52
    MCP_TXB2EID8 = 0x53
    MCP_TXB2EID0 = 0x54
    MCP_TXB2DLC = 0x55
    MCP_TXB2DATA = 0x56
    MCP_RXB0CTRL = 0x60
    MCP_RXB0SIDH = 0x61
    MCP_RXB0SIDL = 0x62
    MCP_RXB0EID8 = 0x63
    MCP_RXB0EID0 = 0x64
    MCP_RXB0DLC = 0x65
    MCP_RXB0DATA = 0x66
    MCP_RXB1CTRL = 0x70
    MCP_RXB1SIDH = 0x71
    MCP_RXB1SIDL = 0x72
    MCP_RXB1EID8 = 0x73
    MCP_RXB1EID0 = 0x74
    MCP_RXB1DLC = 0x75
    MCP_RXB1DATA = 0x76


N_TXBUFFERS = 3
N_RXBUFFERS = 2


CAN_CFGS = {
    CAN_CLOCK.MCP_8MHZ: {
        CAN_SPEED.CAN_5KBPS: [
            MCP_8MHz_5kBPS_CFG1,
            MCP_8MHz_5kBPS_CFG2,
            MCP_8MHz_5kBPS_CFG3,
        ],
        CAN_SPEED.CAN_10KBPS: [
            MCP_8MHz_10kBPS_CFG1,
            MCP_8MHz_10kBPS_CFG2,
            MCP_8MHz_10kBPS_CFG3,
        ],
        CAN_SPEED.CAN_20KBPS: [
            MCP_8MHz_20kBPS_CFG1,
            MCP_8MHz_20kBPS_CFG2,
            MCP_8MHz_20kBPS_CFG3,
        ],
        CAN_SPEED.CAN_31K25BPS: [
            MCP_8MHz_31k25BPS_CFG1,
            MCP_8MHz_31k25BPS_CFG2,
            MCP_8MHz_31k25BPS_CFG3,
        ],
        CAN_SPEED.CAN_33KBPS: [
            MCP_8MHz_33k3BPS_CFG1,
            MCP_8MHz_33k3BPS_CFG2,
            MCP_8MHz_33k3BPS_CFG3,
        ],
        CAN_SPEED.CAN_40KBPS: [
            MCP_8MHz_40kBPS_CFG1,
            MCP_8MHz_40kBPS_CFG2,
            MCP_8MHz_40kBPS_CFG3,
        ],
        CAN_SPEED.CAN_50KBPS: [
            MCP_8MHz_50kBPS_CFG1,
            MCP_8MHz_50kBPS_CFG2,
            MCP_8MHz_50kBPS_CFG3,
        ],
        CAN_SPEED.CAN_80KBPS: [
            MCP_8MHz_80kBPS_CFG1,
            MCP_8MHz_80kBPS_CFG2,
            MCP_8MHz_80kBPS_CFG3,
        ],
        CAN_SPEED.CAN_100KBPS: [
            MCP_8MHz_100kBPS_CFG1,
            MCP_8MHz_100kBPS_CFG2,
            MCP_8MHz_100kBPS_CFG3,
        ],
        CAN_SPEED.CAN_125KBPS: [
            MCP_8MHz_125kBPS_CFG1,
            MCP_8MHz_125kBPS_CFG2,
            MCP_8MHz_125kBPS_CFG3,
        ],
        CAN_SPEED.CAN_200KBPS: [
            MCP_8MHz_200kBPS_CFG1,
            MCP_8MHz_200kBPS_CFG2,
            MCP_8MHz_200kBPS_CFG3,
        ],
        CAN_SPEED.CAN_250KBPS: [
            MCP_8MHz_250kBPS_CFG1,
            MCP_8MHz_250kBPS_CFG2,
            MCP_8MHz_250kBPS_CFG3,
        ],
        CAN_SPEED.CAN_500KBPS: [
            MCP_8MHz_500kBPS_CFG1,
            MCP_8MHz_500kBPS_CFG2,
            MCP_8MHz_500kBPS_CFG3,
        ],
        CAN_SPEED.CAN_1000KBPS: [
            MCP_8MHz_1000kBPS_CFG1,
            MCP_8MHz_1000kBPS_CFG2,
            MCP_8MHz_1000kBPS_CFG3,
        ],
    },
    CAN_CLOCK.MCP_16MHZ: {
        CAN_SPEED.CAN_5KBPS: [
            MCP_16MHz_5kBPS_CFG1,
            MCP_16MHz_5kBPS_CFG2,
            MCP_16MHz_5kBPS_CFG3,
        ],
        CAN_SPEED.CAN_10KBPS: [
            MCP_16MHz_10kBPS_CFG1,
            MCP_16MHz_10kBPS_CFG2,
            MCP_16MHz_10kBPS_CFG3,
        ],
        CAN_SPEED.CAN_20KBPS: [
            MCP_16MHz_20kBPS_CFG1,
            MCP_16MHz_20kBPS_CFG2,
            MCP_16MHz_20kBPS_CFG3,
        ],
        CAN_SPEED.CAN_33KBPS: [
            MCP_16MHz_33k3BPS_CFG1,
            MCP_16MHz_33k3BPS_CFG2,
            MCP_16MHz_33k3BPS_CFG3,
        ],
        CAN_SPEED.CAN_40KBPS: [
            MCP_16MHz_40kBPS_CFG1,
            MCP_16MHz_40kBPS_CFG2,
            MCP_16MHz_40kBPS_CFG3,
        ],
        CAN_SPEED.CAN_50KBPS: [
            MCP_16MHz_50kBPS_CFG1,
            MCP_16MHz_50kBPS_CFG2,
            MCP_16MHz_50kBPS_CFG3,
        ],
        CAN_SPEED.CAN_80KBPS: [
            MCP_16MHz_80kBPS_CFG1,
            MCP_16MHz_80kBPS_CFG2,
            MCP_16MHz_80kBPS_CFG3,
        ],
        CAN_SPEED.CAN_83K3BPS: [
            MCP_16MHz_83k3BPS_CFG1,
            MCP_16MHz_83k3BPS_CFG2,
            MCP_16MHz_83k3BPS_CFG3,
        ],
        CAN_SPEED.CAN_100KBPS: [
            MCP_16MHz_100kBPS_CFG1,
            MCP_16MHz_100kBPS_CFG2,
            MCP_16MHz_100kBPS_CFG3,
        ],
        CAN_SPEED.CAN_125KBPS: [
            MCP_16MHz_125kBPS_CFG1,
            MCP_16MHz_125kBPS_CFG2,
            MCP_16MHz_125kBPS_CFG3,
        ],
        CAN_SPEED.CAN_200KBPS: [
            MCP_16MHz_200kBPS_CFG1,
            MCP_16MHz_200kBPS_CFG2,
            MCP_16MHz_200kBPS_CFG3,
        ],
        CAN_SPEED.CAN_250KBPS: [
            MCP_16MHz_250kBPS_CFG1,
            MCP_16MHz_250kBPS_CFG2,
            MCP_16MHz_250kBPS_CFG3,
        ],
        CAN_SPEED.CAN_500KBPS: [
            MCP_16MHz_500kBPS_CFG1,
            MCP_16MHz_500kBPS_CFG2,
            MCP_16MHz_500kBPS_CFG3,
        ],
        CAN_SPEED.CAN_1000KBPS: [
            MCP_16MHz_1000kBPS_CFG1,
            MCP_16MHz_1000kBPS_CFG2,
            MCP_16MHz_1000kBPS_CFG3,
        ],
    },
    CAN_CLOCK.MCP_20MHZ: {
        CAN_SPEED.CAN_33KBPS: [
            MCP_20MHz_33k3BPS_CFG1,
            MCP_20MHz_33k3BPS_CFG2,
            MCP_20MHz_33k3BPS_CFG3,
        ],
        CAN_SPEED.CAN_40KBPS: [
            MCP_20MHz_40kBPS_CFG1,
            MCP_20MHz_40kBPS_CFG2,
            MCP_20MHz_40kBPS_CFG3,
        ],
        CAN_SPEED.CAN_50KBPS: [
            MCP_20MHz_50kBPS_CFG1,
            MCP_20MHz_50kBPS_CFG2,
            MCP_20MHz_50kBPS_CFG3,
        ],
        CAN_SPEED.CAN_80KBPS: [
            MCP_20MHz_80kBPS_CFG1,
            MCP_20MHz_80kBPS_CFG2,
            MCP_20MHz_80kBPS_CFG3,
        ],
        CAN_SPEED.CAN_83K3BPS: [
            MCP_20MHz_83k3BPS_CFG1,
            MCP_20MHz_83k3BPS_CFG2,
            MCP_20MHz_83k3BPS_CFG3,
        ],
        CAN_SPEED.CAN_100KBPS: [
            MCP_20MHz_100kBPS_CFG1,
            MCP_20MHz_100kBPS_CFG2,
            MCP_20MHz_100kBPS_CFG3,
        ],
        CAN_SPEED.CAN_125KBPS: [
            MCP_20MHz_125kBPS_CFG1,
            MCP_20MHz_125kBPS_CFG2,
            MCP_20MHz_125kBPS_CFG3,
        ],
        CAN_SPEED.CAN_200KBPS: [
            MCP_20MHz_200kBPS_CFG1,
            MCP_20MHz_200kBPS_CFG2,
            MCP_20MHz_200kBPS_CFG3,
        ],
        CAN_SPEED.CAN_250KBPS: [
            MCP_20MHz_250kBPS_CFG1,
            MCP_20MHz_250kBPS_CFG2,
            MCP_20MHz_250kBPS_CFG3,
        ],
        CAN_SPEED.CAN_500KBPS: [
            MCP_20MHz_500kBPS_CFG1,
            MCP_20MHz_500kBPS_CFG2,
            MCP_20MHz_500kBPS_CFG3,
        ],
        CAN_SPEED.CAN_1000KBPS: [
            MCP_20MHz_1000kBPS_CFG1,
            MCP_20MHz_1000kBPS_CFG2,
            MCP_20MHz_1000kBPS_CFG3,
        ],
    },
}
